import java.util.Locale;

/**
 * Created with IntelliJ IDEA.
 * Description: JavaAPI实验一代码
 */
public class Test1 {
    public static void main(String[] args) {
        String string = "HelloWorld";
        char[] chars = string.toCharArray();
        StringBuffer stringBuffer = new StringBuffer();
        for (int i = string.length() - 1; i >= 0; i--) {
            if(string.charAt(i) >= 'A' && string.charAt(i) <= 'Z') {
                stringBuffer.append(String.valueOf(chars[i]).toLowerCase());
            }else {
                stringBuffer.append(String.valueOf(chars[i]).toUpperCase());
            }
        }
        System.out.println(stringBuffer.toString());
    }
    public static void main1(String[] args) {
        String string = "HelloWorld";
        StringBuffer stringBuffer = new StringBuffer();
        for (int i = string.length() - 1; i >= 0; i--) {
            if(string.charAt(i) >= 'A' && string.charAt(i) <= 'Z') {
                String s = string.toLowerCase();
                stringBuffer.append(s.charAt(i));
            }else {
                String s = string.toUpperCase();
                stringBuffer.append(s.charAt(i));
            }
        }
        System.out.println(stringBuffer.toString());
    }
}
